class Solution {
public:
    string frequencySort(string s) {
        class Solution {
public:
    string frequencySort(string s) {
        unordered_map<int,int> table;
        for(auto i:s){
            table[i]++;
        }
        vector<vector<char>> fre(s.size()+1);
        for(auto j:table){
            fre[j.second].push_back(j.first);
        }
        string ans;
        for(int m=fre.size()-1;m>=0;m--){
            /*
            for(int n=0;n<fre[m].size();n++){
                //ans.append();
                for(int k=0;k<m;k++){
                    ans=ans+fre[m][n];
                }
            }
            */
            for(auto i:fre[m]){
                ans.append(m,i);
            }
        }
        return ans;
    }
};
    }
};